package com.yex.dao.otc;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yex.entity.otc.OtcOrder;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * otc 订单表 Mapper 接口
 * </p>
 *
 * @author Little Liu
 * @since 2018-05-03
 */
public interface OtcOrderDao extends BaseMapper<OtcOrder> {
    /**
     * 获取订单信息
     */
    List<Map<String, Object>> getOrderInfoByMap(Map<String, Object> map);

    /**
     * 获取超时订单信息
     */
    List<Map<String, Object>> getOutTimeOrder();

    /**
     * 委托单均价
     *
     * @param entrustId 委托id
     * @return
     */
    BigDecimal findOtcOrderAvg(@Param("entrustId") Integer entrustId);

    /**
     * 修改订单状态
     */
    Integer updateOrderStatus(Map<String, Object> map);
    
    Integer updateOrderPay(OtcOrder otcOrder);
  
    Integer updateOrderConfirmMoney(OtcOrder otcOrder);
    
    Integer cancelOrder(OtcOrder otcOrder);

	int updateCancelOrder(OtcOrder updateOrder);

	int updateSellerComplaintOrder(OtcOrder updateOrder);

	List<Map<String,Object>> selectOtcOrderMapPage(OtcOrder queryOtcOrder, Page<Map<String, Object>> page);

	Map<String, Object> getOrderContact(@Param("id") Integer id);

	Integer queryTodayCancelOrder(@Param("userId") Integer userId);

	Integer queryNowBuyingOrder(OtcOrder queryOtcOrder);

	List<OtcOrder> queryTimeoutNoPayList();

	List<OtcOrder> queryAppealTimeoutNoUploadList();

	List<OtcOrder> queryCofirmTimeoutList();

	List<OtcOrder> getFees(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    int updateOrderFinishDate(OtcOrder updateOrder);

    Map<String,Object> selectOtcOrderMapById(@Param("id") Integer id, @Param("userId") Integer userId);

    List<Map<String,Object>> queryPayNoStatusList();

    Integer updatePayNoStatusMsg(@Param("id") Integer id);

    int queryNowOrder(OtcOrder otcOrder);

    int queryNowOwnOrder(OtcOrder otcOrder);
}
